<template>
	<view id="nameDetail">
		<view class="company">
			<view class="unit">{{voteOrgInfo.org_name}}</view>
		</view>
		<view class="member-line"></view>
		<view class="company">
			<view class="service">总部地址 <text class="childtext">{{voteOrgInfo.address}}</text></view>
			<view class="service">详细地址 <text class="childtext">{{voteOrgInfo.org_position}}</text></view>
			<view class="service">信用代码 <text class="childtext">{{voteOrgInfo.org_social_credit_code}}</text></view>
			<view class="service">法人姓名 <text class="childtext">{{voteOrgInfo.org_sys_name}}</text></view>
			<view class="service">注册资金 <text class="childtext">{{voteOrgInfo.org_enroll_fund}}</text></view>
			<view class="service">企业类型 <text class="childtext">{{voteOrgInfo.org_type}}</text></view>
			<view class="service">资质等级 <text class="childtext">{{voteOrgInfo.org_rank}}</text></view>
			<view class="service">现有员工 <text class="childtext">{{voteOrgInfo.org_employee_total}}</text></view>
			<view class="service">在管项目 <text class="childtext">{{voteOrgInfo.org_pro_total}}</text></view>
			<view class="service">管理模式 <text class="childtext">{{voteOrgInfo.org_manage_way}}</text></view>
			<view class="service">在管面积 <text class="childtext">{{voteOrgInfo.org_area_sum}}</text></view>
			<view class="service">项目类型 <text class="childtext">{{voteOrgInfo.org_pro_type}}</text></view>
		</view>
		
		<view class="member-line"></view>
		<view class="company">
			<view class="unit">物业公司介绍</view>
			<view style="margin-top: 20px;">
				<text class="right" 
				style="color: #4C77F2;font-weight: $bold;text-decoration: underline;" 
				@click="viewDoctor(voteOrgInfo.org_introduce_file)">
				{{voteOrgInfo.org_introduce_file_name}}
				</text>
			</view>
		</view>
		
		<view class="company">
			<view class="unit">物业公司其它文件</view>
			<view style="margin-top: 20px;">
				<text class="right" 
				style="color: #4C77F2;font-weight: $bold;text-decoration: underline;" 
				@click="viewDoctor(voteOrgInfo.org_other_file)">
				{{voteOrgInfo.org_other_file_name}}
				</text>
			</view>
		</view>
		
		<view class="member-line"></view>
		<view class="company">
			<view class="unit">营业执照</view>
			<view style="margin-top: 20px;">
				<img @click="preview(voteOrgInfo.org_license_img)" style="width: 170rpx;height:190rpx;" :src="voteOrgInfo.org_license_img">
			</view>
		</view>
		
		<view class="company">
			<view class="unit">资质证明</view>
			<view style="margin-top: 20px;">
				<img @click="preview(voteOrgInfo.org_aptitude_img)" style="width: 170rpx;height:190rpx;" :src="voteOrgInfo.org_aptitude_img">
			</view>
		</view>
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				voteOrgInfo : {},
			}
		},
		
		onLoad(option) {
			const item = JSON.parse(decodeURIComponent(option.item));
			this.voteOrgInfo = item
			console.log(this.voteOrgInfo)
		},
		methods:{
			//显示文档
			viewDoctor(url) {
				uni.downloadFile({
					url: url,
					success: function(res) {
						var filePath = res.tempFilePath;
						uni.openDocument({
							filePath: filePath,
							showMenu: true,
							success: function(res) {
								console.log('打开文档成功');
							},
							fail() {
								console.log('打开文档失败');
							}
						});
					}
				});
			},
			
			// 图片预览
			preview(item) {
				uni.previewImage({
					urls: [item],
					current: 0,
					longPressActions: {
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	#nameDetail{
		padding: 20rpx 40rpx;
		.memberInfo{
			display: flex;
			justify-content: start;
			align-items: center;
			.member{
				margin-left: 40rpx;
			}
			.floor{
				width: 224rpx;
				height: 44rpx;
				background: #E9F7D9;
				border-radius: 6rpx;
				margin-left: 30rpx;
				color: #417505;
				padding: 8rpx;
			}
			.member-base{
				color: #666;
				font-size: 28rpx;
				margin-top: 28rpx;
			}
		}
		.member-line{
			width: 100%;
			height: 1px;
			margin-top: 60rpx;
			background: #EEEEEE;
		}
		.company{
			margin: 60rpx 0;
			.unit{
				font-size: 36rpx;
				font-weight: bold;
			}
			.service{
				font-size: 28rpx;
				margin-top: 20rpx;
				color: #999999;
				.childtext{
					margin-left: 25px;
					color: black;
				}
			}
			.serviceImg{
				margin-top: 40rpx;
			}
		}
	}
</style>